package com.cet.others.模板方法;

import java.math.BigDecimal;
import java.util.Random;
import java.util.function.Consumer;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-08-30 09:48
 **/
public class BankBussinessHandler {

    private void execute(Consumer<BigDecimal> consumer) {
        getNumber();
        consumer.accept(null);
        judge();

    }

    private void getNumber() {
        Random random = new Random();
        System.out.println("number-00"+ random.nextInt());
    }

    private void judge() {
        System.out.println("give a praised");
    }

    private void save(BigDecimal amount) {
        execute(a -> System.out.println("save " + amount));
    }

    public static void main(String[] args) {
        BankBussinessHandler bankBussinessHandler = new BankBussinessHandler();
        bankBussinessHandler.save(new BigDecimal("1000.123456"));
    }
}
